import request from '@/config/axios'

// 门店商品分类 VO
export interface GoodsCategoryVO {
  id: number // 分类编号
  storeId: number // 门店编号
  parentId: number // 父分类编号
  name: string // 分类名称
  picUrl: string // 移动端分类图
  sort: number // 分类排序
  status: number // 开启状态
}

// 门店商品分类 API
export const GoodsCategoryApi = {
  // 查询门店商品分类分页
  getGoodsCategoryPage: async (params: any) => {
    return await request.get({ url: `/store/goods-category/page`, params })
  },

  // 查询门店商品分类详情
  getGoodsCategory: async (id: number) => {
    return await request.get({ url: `/store/goods-category/get?id=` + id })
  },

  // 新增门店商品分类
  createGoodsCategory: async (data: GoodsCategoryVO) => {
    return await request.post({ url: `/store/goods-category/create`, data })
  },

  // 修改门店商品分类
  updateGoodsCategory: async (data: GoodsCategoryVO) => {
    return await request.put({ url: `/store/goods-category/update`, data })
  },

  // 删除门店商品分类
  deleteGoodsCategory: async (id: number) => {
    return await request.delete({ url: `/store/goods-category/delete?id=` + id })
  },

  // 导出门店商品分类 Excel
  exportGoodsCategory: async (params) => {
    return await request.download({ url: `/store/goods-category/export-excel`, params })
  },
}